package com.qyl.hrm.service.impl;

import java.util.List;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

import com.qyl.hrm.dto.User;
import com.qyl.hrm.mapper.UserMapper;
import com.qyl.hrm.service.UserService;
import com.qyl.hrm.utils.PageBean;

@Service
@Transactional
public class UserServiceImpl implements UserService {

	@Autowired
	private UserMapper userMapper;
	
	@Override
	public User getUserByNameAndPwd(User user) {
		
		return userMapper.getUserByNameAndPwd(user);
	}

	@Override
	public Integer getRecordCount(User user) {
		
		return userMapper.getRecordCount(user);
	}

	@Override
	public void getUserList(User user, PageBean pageBean) {
		
		List<User> list = userMapper.getUserList(user,pageBean);
		
		pageBean.setList(list);
	}

	@Override
	public int addUser(User user) {
		
		return userMapper.addUser(user);
	}

	@Override
	public int deleteUser(Integer id) {
		
		return userMapper.deleteUser(id);
	}

	@Override
	public User getUserById(Integer id) {
		
		return userMapper.getUserById(id);
	}

	@Override
	public int updateUser(User user) {
		
		return userMapper.updateUser(user);
	}

	@Override
	public List<User> getAllUsers() {
		
		return userMapper.getAllUsers();
	}

	@Override
	public int saveAllUser(List<User> list) {

		return userMapper.saveAllUser(list);
	}

}
